// 医院列表 请求
import { request } from "@/utils/http";
// 引入类型判断
import {
  PagingListRequest,
  hospitalListRequest,
  regionReturnResultType,
  HospitalDetailsReturnType,
  getpageDataListType,
  SchedulingRules,
  ParameterType,
  accordingToTime,
  accordingToTimeType,
} from "./model/hospitalListTypes";
//1.获取医院列表数据的请求
export const SendHospitalListRequest = (
  page: number,
  limit: number,
  paramsList: PagingListRequest
) => {
  return request.get<any, hospitalListRequest>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params: paramsList,
    }
  );
};
// 2.获取省份信息的请求
export const ProvinceInformationRequest = () => {
  return request.get<any, regionReturnResultType>(
    "/admin/cmn/dict/findByDictCode/province"
  );
};
// 3.获取所有的市级和区级区域
export const GetRegionalDataRequest = (parentId: string) => {
  return request.get<any, regionReturnResultType>(
    `/admin/cmn/dict/findByParentId/${parentId}`
  );
};
// 4.发送状态码更改状态
export const ChangeStatusRequest = (id: string, status: 0 | 1) => {
  return request.get<any, null>(
    `/admin/hosp/hospital/updateStatus/${id}/${status}`
  );
};
// 5.请求医院详细信息
export const HospitalDetailsRequest = (id: string) => {
  return request.get<any, HospitalDetailsReturnType>(
    `/admin/hosp/hospital/show/${id}`
  );
};
// 6.获取分页列表
export const getpageRequest = (hoscode: string) => {
  return request.get<any, getpageDataListType>(
    `/admin/hosp/department/${hoscode}`
  );
};
// 7.获取排班规则数据
export const SchedulingRulesRequest = ({
  page,
  limit,
  hoscode,
  depcode,
}: ParameterType) => {
  return request.get<any, SchedulingRules>(
    `/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`
  );
};
// 8.获取某个科室吗某个时间具体详情
export const findScheduleListRequest = ({
  hoscode,
  depcode,
  workDate,
}: accordingToTime) => {
  return request.get<any, accordingToTimeType>(
    `/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`
  );
};
